import cx_Oracle

# dsnStr = cx_Oracle.makedsn("192.168.110.214", 1521, "HORNEIP")  # 测试库
dsnStr = cx_Oracle.makedsn("192.168.110.205", 1521, "EIP")  # 数据库配置
conn = cx_Oracle.connect("EIP", "EIP", dsnStr, threaded=True)
c = conn.cursor()

headers = {'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"}

# 原料类型代码说明
exr = "10"  # 汇率
oil = "20"  # 原油
pc = "40"  # PC塑料
ab = "41"  # ABS塑料
pc_abs = "42"  # PC+ABS塑料
pom = "43"  # POM塑料
cop = "50"  # 1#铜
alu0 = "60"  # 铝锭
alu1 = "61"  # 铝锭无票
ste = "70"  # 不锈钢


# 网址
exchange_rate_url = "https://cn.investing.com/currencies/usd-cny-historical-data/"  # 汇率
oil_url = "http://www.cnoil.com/youjia/"  # 原油
# copper_url_0 = "https://www.ccmn.cn/history_data/cjxh.html"  # 铜
copper_url = "https://www.ccmn.cn/historyprice/getCorpStmarketPriceList"  # 铜
copper_url_old = "https://copper.ccmn.cn/"
aluminium_url = "http://www.lvdingjia.com/price/nanhai/"  # 铝锭
steel_url = 'https://www.exbxg.com:8443/jsonp?{"service":"U_D_FindSpotPriceList","body":{"beginDate":"","endDate":"","limit":1,"breedId":"2","breedName":"304不锈钢","status":"2"}}'  # 不锈钢


def plastic_urls():
    basic = "https://www.soliao.com/price/{}/list-1.html"  # 塑料
    urls = []
    plastic_pc_url = basic.format("taiwanqimei-pc")
    plastic_abs_url = basic.format("taiwanqimei-abs")
    plastic_pc_abs_url = basic.format("taiwanqimei-pc+abs")
    plastic_pom_url = basic.format("ribenbaoli-pom")
    urls.append(plastic_pc_url)
    urls.append(plastic_abs_url)
    urls.append(plastic_pc_abs_url)
    urls.append(plastic_pom_url)
    return urls
